<template>
  <div class='container'>
    <el-dialog
  title="题目审核"
  :visible="checkDialogVisible"
  width="20%"
  @close="handleClose">
  <el-form ref="form" :model="FormData"  :rules="rules">
    <el-form-item >
      <el-radio-group v-model="chkState">
      <el-radio :label='1'>通过</el-radio>
      <el-radio :label='2'>拒绝</el-radio>
    </el-radio-group>
    </el-form-item>
    <el-form-item prop="chkRemarks">
       <el-input type="textarea"  placeholder="请输入审核意见" v-model="FormData.chkRemarks" ></el-input>
    </el-form-item>
  </el-form>

  <span slot="footer" class="dialog-footer">
    <el-button @click="handleClose">取 消</el-button>
    <el-button type="primary" @click="handleCheck">确 定</el-button>
  </span>
</el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {

  name: 'questionscheck',
  data () {
    return {
      chkState: 1,
      FormData: {
        chkRemarks: ''
      },
      rules: {
        chkRemarks: [{ required: true, message: '其请输入审核意见', trigger: ['blur', 'change'] }]
      }
    }
  },
  props: {
    checkDialogVisible: {
      type: Boolean,
      default: false
    },
    checkdata: {
      type: Object,
      required: true
    }
  },
  methods: {
    handleClose () {
      this.$emit('update:checkDialogVisible', false)
    },
    handleCheck () {
      this.$refs.form.validate(async boo => {
        if (!boo) return
        console.log(this.checkdata.id)
        await choiceCheck({ id: this.checkdata.id, chkState: this.chkState, chkRemarks: this.FormData.chkRemarks })

        this.FormData.chkRemarks = ''
        this.chkState = 1
        this.handleClose()
        this.$emit('updateAll')
      })
    }
  }
}
</script>

<style scoped lang='scss'></style>
